/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package controller;

import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import modelo.Cliente;
import modelo.DAO;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

/**
 *
 * @author odeen
 */
public class EliminarClienteController extends AbstractController {

    public EliminarClienteController() {
    }
    
    protected ModelAndView handleRequestInternal(
            HttpServletRequest request, 
            HttpServletResponse response) throws Exception {
        Cliente c = dao.buscarClientePorId(Integer.parseInt(request.getParameter("id")));
        dao.borrar(c);

        return homePageController.handleRequestInternal(request, response);
        
//        List<Cliente> clientes = dao.buscarTodosClientes();
//        return new ModelAndView("home","clientes",clientes);
    }
    protected DAO dao;

    public DAO getDao() {
        return dao;
    }

    public void setDao(DAO dao) {
        this.dao = dao;
    }
    protected HomePageController homePageController;

    public HomePageController getHomePageController() {
        return homePageController;
    }

    public void setHomePageController(HomePageController homePageController) {
        this.homePageController = homePageController;
    }
    

}